Skip to content

Instantly share code, notes, and snippets.

@rodrwan
rodrwan / binary-tree.js
Last active November 6, 2024 23:28
Implementación árbol binario en JavaScript
class Node {
constructor (value) {
this.value = value
this.right = null
this.left = null
}
}
class Tree {
constructor () {
@santaklouse
santaklouse / CrossOver.sh
Last active November 6, 2024 23:27
unlimited CrossOver trial (MacOS)
#!/usr/bin/env bash
# checck if pidof exists
PIDOF="$(which pidof)"
# and if not - install it
(test "${PIDOF}" && test -f "${PIDOF}") || brew install pidof
# find app in default paths
CO_PWD=~/Applications/CrossOver.app/Contents/MacOS
test -d "${CO_PWD}" || CO_PWD=/Applications/CrossOver.app/Contents/MacOS
@dmorosinotto
dmorosinotto / base.component.ts
Last active November 6, 2024 23:26
Angular BaseComponent with handle destroy$ and takeUntil pattern to unsubscribe!
import { Directive, OnDestroy } from "@angular/core";
import { Subject } from "rxjs";
import { takeUntil } from "rxjs/operators";
@Directive() // Needed only for Angular v9+ strict mode that enforce decorator to enable Component inheritance
export abstract class BaseComponent implements OnDestroy {
// _destroy$ is LAZY: it'll be created (and allocate memory) only if you use takeUntilDestroy
private _destroy$?: Subject<void>;
protected takeUntilDestroy = <T>() => {
if (!this._destroy$) this._destroy$ = new Subject<void>(); // LAZY Subject
@ksasao
ksasao / TextAssistant.ino
Created November 6, 2024 13:55
M5Stack LLM Module で日本語対話 https://x.com/ksasao/status/1854157588247806342 #M5StackLLM
/*
* SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
* SPDX-License-Identifier: MIT
* M5Stack LLM Module で日本語対話。Serial MonitorでBoth BL&CRを設定するとよいです。
*/
#include <Arduino.h>
#include <M5Unified.h>
#include <M5ModuleLLM.h>
M5ModuleLLM module_llm;
@thr0wn
thr0wn / mandelbrot.py
Last active November 6, 2024 23:22
Mandelbrot set generated using python turtle
import turtle
import math
def mandelbrot(z , c , n=20):
if abs(z) > 10 ** 12:
return float("nan")
elif n > 0:
return mandelbrot(z ** 2 + c, c, n - 1)
else:
return z ** 2 + c
@Aneureka
Aneureka / sync-from-chrome-to-safari
Last active November 6, 2024 23:18
An apple script to sync history, bookmarks & passwords from google chrome to safari.
# Add a scheduled sync task at 4:00 am
# Some privileges should be granted to `cron` *manually*, so you may test `* * * * *` (run every second) first to grant the needed privileges in advance
0 4 * * * osascript /path/to/your/sync-from-chrome-to-safari.scpt
@neoeno
neoeno / Gemfile
Last active November 6, 2024 23:13
Pokemon Go Slack Bot
source "https://rubygems.org"
gem "httparty"
gem "geocoder"
gem "slack-poster"
@HdroguettA
HdroguettA / salesforceAttachmentDownload.ts
Last active November 6, 2024 23:12
Download Salesforce Attachments with Node.js (TypeScript) utilising JSforce.
import JSForce, { Connection } from "jsforce";
import dotenv from "dotenv";
import fs from "node:fs";
import pLimit from "p-limit";
dotenv.config();
const connection: Connection = new JSForce.Connection();
const download = async () => {
// Ensure the statements directory exists to push files into during downloading.
@neoeno
neoeno / gist:68a199005ef189d83a19b862682e68eb
Created August 1, 2017 12:29
Basic PHP strachey love letter algorithm extracted from https://github.com/gingerbeardman/loveletter
$sals1 = array("Beloved", "Darling", "Dear", "Dearest", "Fanciful", "Honey");
$sals2 = array("Chickpea", "Dear", "Duck", "Jewel", "Love", "Moppet", "Sweetheart");
$adjs = array("affectionate", "amorous", "anxious", "avid", "beautiful", "breathless", "burning", "covetous", "craving", "curious", "eager", "fervent", "fondest", "loveable", "lovesick", "loving", "passionate", "precious", "seductive", "sweet", "sympathetic", "tender", "unsatisfied", "winning", "wistful");
$nouns = array("adoration", "affection", "ambition", "appetite", "ardour", "being", "burning", "charm", "craving", "desire", "devotion", "eagerness", "enchantment", "enthusiasm", "fancy", "fellow feeling", "fervour", "fondness", "heart", "hunger", "infatuation", "little liking", "longing", "love", "lust", "passion", "rapture", "sympathy", "thirst", "wish", "yearning");
$advs = array("affectionately", "ardently", "anxiously", "beautifully", "burningly", "covetously", "curiously", "eagerly", "fervently", "fondly", "impatiently", "keenly", "lovingly"